//
//  ChoseAddressTableViewCell.m
//  PeopleStreet
//
//  Created by 辰领科技 on 16/1/15.
//  Copyright © 2016年 yuf. All rights reserved.
//

#import "ChoseAddressTableViewCell.h"

@implementation ChoseAddressTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        UIImageView * image = [[UIImageView alloc]initWithFrame:flexibleFrame(CGRectMake(11, 14, 298, 115), NO)];
        image.image = [UIImage imageNamed:@"choseAddress2"];
        [self.contentView addSubview:image];
        NSArray * nameArray = @[@"收货人",@"手机号",@"收货地址"];
        for (int i = 0; i<3; i++) {
            UILabel * label = [[UILabel alloc]initWithFrame:flexibleFrame(CGRectMake(23, 17+25*i, 70, 15), NO)];
            label.text = nameArray[i];
            label.textAlignment = NSTextAlignmentLeft;
            label.textColor = [UIColor colorWithWhite:0.702 alpha:1.000];
            label.font = [UIFont systemFontOfSize:15*VerticalTexeRatio()];
            [image addSubview:label];
            
            UILabel * Label = [[UILabel alloc]initWithFrame:flexibleFrame(CGRectMake(90, 17+25*i, 190, 15), NO)];
            Label.text = nameArray[i];
            Label.textAlignment = NSTextAlignmentLeft;
            Label.textColor = [UIColor colorWithWhite:0.396 alpha:1.000];
            Label.font = [UIFont systemFontOfSize:15*VerticalTexeRatio()];
            [image addSubview:Label];
            if (i==0) {
                _reciverName = Label;
            }else if (i==1){
                _reciverPhone = Label;
            }else{
                Label.numberOfLines = 0;
                Label.frame = flexibleFrame(CGRectMake(90, 17+25*i, 190, 0), NO);
                _reciverAddress = Label;
            }
            
        }
        
        UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.frame = flexibleFrame(CGRectMake(260, 36, 24, 24), NO);
        [button setBackgroundImage:[UIImage imageNamed:@"choseAddress4"] forState:UIControlStateNormal];
        [button setBackgroundImage:[UIImage imageNamed:@"choseAddress3"] forState:UIControlStateSelected];
        [button addTarget:self action:@selector(editing:) forControlEvents:UIControlEventTouchUpInside];
        [self.contentView addSubview:button];
    }
    return self;
}

- (void)editing:(UIButton *)sender{
    sender.selected = !sender.selected;

        _editingBlock(@"1");

  
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
